<!DOCTYPE html>
<html>
    <body>
        <h1>测试邮件验证系统</h1>
        <form action="hello_world.html" onsubmit="return validate_form(this)" method="POST">
            Email:<input type="text" name="email" size="30">
            <input type="submit" value="submit">
        </form>

        <script>
            function validate_required(feild,alerttxt)
            {
                with(feild)
                {
                    apos=value.indexOf("@")
                    dotpos=value.lastIndexOf(".")
                    if(value==null||value=="")
                        {alert(alerttxt);return false}
                    if(apos<1||dotpos-apos<2)
                        {alert(alerttxt);return false}
                    else
                        {return true}
                }
            }

            function validate_form(thisform)
            {
                with(thisform)
                    {
                        if(validate_required(email,"你输入的邮箱不符合规范，请重新输入。")==false)
                            {email.focus();return false}
                    }
            }
        </script>
    </body>
</html>